//
//  YSMainTabBarViewController.m
//  YSZC
//
//  Created by 张斌 on 16/4/13.
//  Copyright © 2016年 YueShiKeJi. All rights reserved.
//

#import "YSMainTabBarViewController.h"














#import "LoadVcManager.h"












#import "HomeTableViewController.h"
#import "MessageTableViewController.h"
#import "StarTableViewController.h"
#import "MineTableViewController.h"





#import "YSMainNavViewController.h"



@interface YSMainTabBarViewController ()

@end

@implementation YSMainTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    

    [[UITabBar appearance] setTintColor:[UIColor colorWithRed:249/255.0 green:60/255.0 blue:71/255.0 alpha:1]];
    
    [self addChildVCs];
    
    
}


//添加子控制器的方法
- (void)addChildVCWithVc:(UIViewController*)vc andImagename:(NSString*)imagename andTitle:(NSString*)title{
    YSMainNavViewController * nav = [[YSMainNavViewController alloc] initWithRootViewController:vc];
    vc.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:imagename];
        vc.tabBarItem.selectedImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@sel",imagename]];

    [self addChildViewController:nav];
  
}
// 添加子控制器们的方法
- (void)addChildVCs{

    [self addChildVCWithVc:[LoadVcManager sbVCWithsbname:@"HomeTableViewController"] andImagename:@"homepage" andTitle:@"首页"];
    [self addChildVCWithVc:[LoadVcManager sbVCWithsbname:@"MessageTableViewController"]  andImagename:@"mes" andTitle:@"消息"];
    [self addChildVCWithVc:[LoadVcManager sbVCWithsbname:@"StarTableViewController"]  andImagename:@"star" andTitle:@"星投人"];
    [self addChildVCWithVc:[LoadVcManager sbVCWithsbname:@"MineTableViewController"]  andImagename:@"me" andTitle:@"个人中心"];
    
}
@end
